#最大值
$execute store result score #count temp run data get entity @s Inventory[{Slot:8b}].components."minecraft:custom_data".bag[$(index)].count
execute if score #count temp matches 512.. run return run scoreboard players reset #count temp

summon armor_stand ~ ~ ~ {Tags:[tempAAC],Invisible:true,Small:true,Marker:true,Invulnerable:true}

item replace entity @n[tag=tempAAC,type=armor_stand,distance=..1] weapon.mainhand from entity @s hotbar.8

$execute store result score #count temp run data get entity @n[tag=tempAAC,distance=..1,type=armor_stand] HandItems[0].components."minecraft:custom_data".bag[$(index)].count
$execute store result entity @n[tag=tempAAC,type=armor_stand,distance=..1] HandItems[0].components."minecraft:custom_data".bag[$(index)].count int 1 run scoreboard players add #count temp $(value)

#最大值约束
$execute if score #count temp matches 513.. store result entity @n[tag=tempAAC,type=armor_stand,distance=..1] HandItems[0].components."minecraft:custom_data".bag[$(index)].count int 1 run scoreboard players set #count temp 512

item replace entity @s hotbar.8 from entity @n[tag=tempAAC,distance=..1,type=armor_stand] weapon.mainhand

scoreboard players reset #count temp
kill @n[tag=tempAAC,distance=..1,type=armor_stand]

#update
function dab:system/arrow_bundle/storage/update